#include <iostream>
#include <signal.h>
#include <unistd.h>

void handler(int signum)
{
    std::cout << "我们收到一个" << signum << "号信号" << std::endl;
    exit(0);
}

int main(int argc,char *argv[])
{
    // ./process -9 pid
    if (argc != 3)
    {
        // Uasge();
        exit(0);
    }
    int signumber = std::stoi(argv[1] + 1);
    int processpid = std::stoi(argv[2]);
    kill(processpid,signumber);

    /*
    // 捕捉2号信号
    signal(2,handler);
    while (true)
    {
        std::cout << "runing...,getpid()" << getpid() << std::endl;
        sleep(1);
    }
    */
    return 0;
}